$(function() {
	//鑾峰彇鏈嶅姟鏃堕棿
	function hasfinishedtime() {
		var href = location.href,
			cachetimeurl = "";
		cachetimeurl = href.indexOf('lenovouat') != -1 ? "//papi.lenovouat.com" : "//papi.lenovo.com.cn";
		$.ajax({
			url: cachetimeurl + '/cache/time',
			dataType: 'jsonp',
			async: "false",
			jsonp: "callback",
			success: function(data) {
				if(data.curTime) {
					var time = new Date(data.curTime * 1000);
					var h = time.getHours();
					var m = time.getMinutes();
					var s = time.getSeconds();
					setTimeS(h, m, s)
				}
			},
			error: function() {}
		});
	};

	function setTimeS(h, m, s) {
		try {
			$(".colis").each(function(index) {
				var _this = this;
				var onff = true;
				var endTime = parseFloat($(this).attr("endTime"));
				var endTimeSecond = parseFloat($(this).attr("endTimeSecond"))
				if(index != 3) {
					if(endTime == h && s > endTimeSecond && m == 0) {
						var t = (endTimeSecond - s) * 1000
						if(onff) {
							setTimeout(function() {
								$(_this).removeClass("weiks");
								$(_this).addClass("sjdl");
								$(_this).attr("has", "true");

							}, t)
						}
					} else if(endTime > h) {
						var ts = ((((endTime - h) * 60 - m) * 60) - s) * 1000
						if(onff) {
							var settime = endTimeSecond * 1000;
							setTimeout(function() {
								$(_this).removeClass("weiks")
								$(_this).attr("has", "flase");
								setTimeout(function() {
									$(_this).addClass("sjdl");
									$(_this).attr("has", "true");
								}, settime)
							}, ts)
						}
						$(_this).addClass("weiks");
						$(_this).attr("has", "true");
					} else {
						var time = endTime + 10;
						$(this).attr("endTime", time);
						if(time == h && s > endTimeSecond && m == 0) {
							var t = (endTimeSecond - s) * 1000
							if(onff) {
								setTimeout(function() {
									$(_this).removeClass("weiks");
									$(_this).addClass("sjdl");
									$(_this).attr("has", "true");
								}, t)
							}
							$(".ultime").find("li").eq(index).html("姣忓ぉ" + time + ":00鐐�");
						} else if(time > h) {
							var ts = ((((time - h) * 60 - m) * 60) - s) * 1000;
							if(onff) {
								setTimeout(function() {
									$(_this).removeClass("weiks")
									$(_this).attr("has", "flase");
									var settime = endTimeSecond * 1000;
									setTimeout(function() {
										$(_this).addClass("sjdl");
										$(_this).attr("has", "true");
									}, settime)
								}, ts)
							}
							$(".ultime").find("li").eq(index).html("姣忓ぉ" + time + ":00鐐�")
							$(_this).addClass("weiks");
							$(_this).attr("has", "true");
						} else {
							var nextTime = time - 10;
							$(".ultime").find("li").eq(index).html("姣忓ぉ" + nextTime + ":00鐐�")
							$(_this).addClass("weiks");
							$(_this).attr("has", "true");
						}

					}

				}

			})

		} catch(error) {
			console.log("鍊掕鏃跺嚭閿欎簡")
		}

	}

	function getCoupon(couponId, doc) {

		var damoURl = ""
		if(window.location.href.indexOf('lenovouat') != -1) {
			damoURl = 'https://buy1.lenovouat.com'
		} else {
			damoURl = 'https://buy.lenovo.com.cn'
		}
		if(!passport.isLogin()) {
			if(window.location.href.indexOf('admin.lenovo') != -1) {
				if(window.location.search.split('&')[1].indexOf('terminal') != -1 && window.location.search.split('&')[1].split('=')[1] == 2) {
					var loginUrl = "https://reg.lenovo.com.cn/auth/v1/login?ticket=b044d754-bda2-4f56-9fea-dcf3aecfe782&iswap=0&ru=";
					window.location.href = loginUrl + window.location.href;
				} else if(window.location.search.split('&')[1].indexOf('terminal') != -1 && window.location.search.split('&')[1].split('=')[1] == 1) {
					passport.show();
				}
			} else if(window.location.href.indexOf('mactivity.lenovo') != -1) {
				var loginUrl = "https://reg.lenovo.com.cn/auth/v1/login?ticket=b044d754-bda2-4f56-9fea-dcf3aecfe782&iswap=0&ru=";
				window.location.href = loginUrl + window.location.href;
			} else {
				passport.show();
			}
		} else {
			try {
				var lenovoid = passport.cookie.lenovoId;
				if(couponId) {
					$.ajax({
						dataType: "jsonp",
						jsonp: "callbackparam",
						url: damoURl + "/couponnew/api/coupon/receiveCoupon.jhtm?shopId=1&salesCouponId=" + couponId + "&getTerminal=1",
						success: function(db) {
							if(db.success) {
								doc.addClass("qdl")
							} else {
								doc.addClass("sjdl");

							}
						},
						error: function(db) {
							if(db.msg !== undefined)
								alert(db.msg || "绯荤粺绻佸繖璇烽噸璇�");
						}
					});
				}
			} catch(e) {}
		}
	};
	//鏌ヨ浼樻儬鍒�
	function cxCoupon(coId) {
		try {
			var damoURl = ""
			if(window.location.href.indexOf('lenovouat') != -1) {
				damoURl = 'https://buy1.lenovouat.com'
			} else {
				damoURl = 'https://buy.lenovo.com.cn'
			}
			if(passport.isLogin()) {
				$.ajax({
					dataType: "jsonp",
					jsonp: "callbackparam",
					url: "" + damoURl + "/couponnew/api/coupon/getUserIshaveTheCoupon.jhtm?shopId=1&salesCouponIds=" + coId.join(','),
					success: function(db) {
						if(db.success) {
							var data = db.t;
							for(var i = 0; i < data.length; i++) {
								if(data[i].has == true) {
									$("#" + data[i].id).attr("has", "true");
									$("#" + data[i].id).addClass("qdl");
								}
							}
						}
					},
					error: function(db) {
						if(db.msg !== undefined)
							alert(db.msg || "绯荤粺绻佸繖璇烽噸璇�");
					}
				});
			}
		} catch(error) {
			console.log("浼樻儬鍒告煡璇㈠嚭閿欎簡")
		}

	}
	$(".colis").on("click", function() {
		if($(this).attr("has") != "true") {
			getCoupon($(this).attr("couponId"), $(this))
		}

	});

	$(".lottery-dialog").click(function() {
		$(".lottery-dialog-box").hide();
	});

	hasfinishedtime();
	var coId = [];
	$(".colis").each(function(index, e) {
		coId[index] = $(this).attr("couponId");
		$(this).attr("id", $(this).attr("couponId"));

	});
	cxCoupon(coId);
});

(function() {
	var domain = 'lenovo.com.cn';
	if(window.location.href.indexOf('lenovo.com.cn') == -1) {
		domain = 'lenovouat.com';
	}

	/* 
	    =========================================  jinzz2 start  ===========================================
	*/
	var _event = {
		start: function() {
			var __this = this;
			$("#dialog-submit").on("click", function() {
				try {
					var phoneNum = $("#dialog-input-phone").val();
					var check_result = __this.checkPhoneNum(phoneNum);
					if(check_result.isSuccess) {
						// 鎴愬姛
						$.ajax({
							type: 'get',
							dataType: 'jsonp',
							jsonp: 'callbackparam',
							url: 'https://promotion.' + domain + '/api/activity/addReservation.jhtm',
							data: {
								gcode: '1004633',
								shopId: 1,
								phone: phoneNum,
								terminal: 1
							},
							success: function(data) {
								__this.dialogHide();
								if(data.success) {
									$('#appointment1').text('宸查绾�').unbind();
									alert('鎮ㄥ凡棰勭害鎴愬姛');
								} else alert('棰勭害澶辫触');
							},
							error: function() {
								__this.dialogHide();
							}
						})
					} else {
						__this.setDialogTipText(check_result.text);
						__this.dialogTipShow();
					}
				} catch(err) {

				}
			})
			$(".dialog-close").on("click", function() {
				__this.dialogHide();
			})
			$("#appointment1").on("click", function() {
				if(!passport.isLogin()) {
					passport.show();
				} else {
					__this.dialogShow();
					__this.dislogClearTip();
					if(passport && passport.cookie && passport.cookie) {
						var loginName = $.trim(passport.cookie.loginName);
						var reg = /^0?1\d{10}$/;
						if(reg.test(loginName)) {
							$('#dialog-input-phone').val(loginName)
						}
					}
				}
			})
			// $("#appointment2").on("click",function(){
			//     // __this.dialogShow();
			//     // __this.dislogClearTip();
			// }) 
			$("#appointment3").on("click", function() {
				__this.dialogShow();
				__this.dislogClearTip();

			})

			// 椤甸潰鎵撳紑鏃跺垽鏂槸鍚﹀凡棰勭害
			try {
				if(passport.isLogin()) {
					$.ajax({
						url: 'https://promotion.' + domain + '/api/activity/isHaveReservation.jhtm?shopId=1&gcode=1004633&activityId=12827',
						dataType: 'jsonp',
						jsonp: "callbackparam",
						success: function(data) {
							if(data.success) {
								if(data.t) $('#appointment1').text('宸查绾�').unbind();
							}
						},
						error: function(XMLHttpRequest, textStatus, errorThrown) {
							console.log(XMLHttpRequest, textStatus, errorThrown)
						}
					})
				}
			} catch(err) {

			}
		},
		// 璁剧疆dialog tip
		setDialogTipText: function(text) {
			$("#dialog-input-phone-tip").text(text);
		},
		// 娓呯┖dialog tip
		dislogClearTip: function() {
			this.setDialogTipText("");
		},
		// dialog鏄剧ず
		dialogShow: function() {
			$("#le-dialog-box").show();
			$("body").addClass("maskShow");
		},
		// dialog 闅愯棌
		dialogHide: function() {
			$("#le-dialog-box").hide();
			$("body").removeClass("maskShow");
		},
		// dialog tip 鏄剧ず
		dialogTipShow: function() {
			var __this = this;
			$("#dialog-input-phone-tip").show();
			setTimeout(function() {
				__this.dialogTipHide();
			}, 3000);
		},
		// dialog tip 闅愯棌
		dialogTipHide: function() {
			$("#dialog-input-phone-tip").hide();
		},
		// 鏍￠獙鎵嬫満鍙�
		checkPhoneNum: function(tel) {
			var reg = /^1[3456789]\d{9}$/;
			var result = {
				text: "鎵嬫満鍙锋纭�",
				isSuccess: true,
			};
			if(tel == "") {
				result = {
					isSuccess: false,
					text: "鎵嬫満鍙蜂笉鑳戒负绌猴紒"
				}
			} else if(!(reg.test(tel))) {
				result = {
					isSuccess: false,
					text: "鎵嬫満鍙锋湁璇紒"
				}
			}
			return result;
		},
	}
	_event.start();
	/* 
	    =========================================  jinzz2 end  ===========================================
	*/
})();

/* 
       =========================================  liulb7 start  ===========================================
   */
var ajaxdomain = "//papi.lenovo.com.cn";
var platid = 1;

var couponsDoman, addrsDoman;

if(document.domain.indexOf('lenovouat') == -1) {
	couponsDoman = "//coupon.lenovo.com.cn/lenovo/saleCoupons.jhtm";
	addrsDoman = "https://shop.lenovo.com.cn/mycenter/win.html";
	ajaxdomain = "//papi.lenovo.com.cn";
} else {
	couponsDoman = "//coupon.lenovouat.com/lenovo/saleCoupons.jhtm";
	addrsDoman = "//shop.lenovouat.com/mycenter/win.html";
	ajaxdomain = "//papi.lenovouat.com";
}

/*婊戝潡楠岃瘉*/
var mySlidercaptcha;

var Engine = function(pList, container) {
	this.startFlag = true;
	var that = this;
	this.speed = 100;
	this.parts = pList;
	this.pViews = [];
	this.result = -10;

	this.render = function() {
		var num = [0, 1, 2, 7, -1, 3, 6, 5, 4];
		for(var i = 0; i < num.length; i++) {
			if(num[i] == -1) {
				$(container).append("<li><div class='play-btn img-box' latag='latag_wap_activity_zhuanpan0208_draw'><img src='./images/lottery/play-botton.png' class='play-btn-img'></div></li>");
			} else {
				var pv = new PartView(this.parts[num[i]]);
				this.pViews.push(pv);
				pv.render($(container));
			}
		}

		return this;
	}

	this.reset = function() {
		for(var i = 0; i < this.pViews.length; i++) {
			this.pViews[i].deActive();
		}
	}

	var count = 0;
	var time122 = 0;
	this._lastLoopTick = 0;
	this._currentLoopTick = 0;
	this.visualIndexArr = [0, 1, 2, 4, 7, 6, 5, 3];

	this.getPartView = function(index) {
		return this.pViews[this.visualIndexArr[index]];
	}

	this.start = function() {
		this.speed = 100;
		this.reset();

		time122 = window.setInterval(function() {
			that._currentLoopTick = new Date().getTime();

			if(that._currentLoopTick - that._lastLoopTick >= that.speed) {
				that._lastLoopTick = that._currentLoopTick;

				if(count == 8) {
					that.getPartView(count - 1).deActive();
					count = 0;
				}

				if(count > 0) {
					that.getPartView(count - 1).deActive();
				}
				that.getPartView(count).active();

				that.speed += 20;
				if(that.speed > 500 && that.getPartView(count).model.id == that.result) {
					window.clearInterval(time122);
					that.startFlag = true;
					mySlidercaptcha.reset();
					// alert(that.result);

					if(that.prizeType == 0) { // 瀹炵墿
						$(".gotoaddrs").text("缁存姢鏀惰揣鍦板潃");
						$(".gotoaddrs").show();
					} else if(that.prizeType == 7) { // 浼橀叿浼氬憳
						$(".gotoaddrs").text("鍘婚鍙�");
						$(".gotoaddrs").show();
					} else {
						$(".gotoaddrs").hide();
					}
					if(that.prizeType == 3) { //鏈腑濂�
						$(".box2").show();
						$(".box1").hide();
					} else {
						$(".box1").show();
						$(".box2").hide();
					}
					$("#result").show();
					if(that.prizeTxt != undefined && that.prizeTxt != "" && that.prizeType != 3) {
						var txt = that.prizeTxt.replace(/;/g, "<br />");
						$("#result .giftname").css("text-align", "left");
						$("#result .giftname").css("padding-left", "30px");
						$("#result .giftname").html(txt);
					}

					getLotteryHistory();
				}
				count++;
			}
		}, 10);
	}
}

var Part = function(url, id) {
	this.url = url;
	this.color = "white";
	this.id = id;
}

var PartView = function(model) {
	this.model = model;
	this.el = $("<li><div class='lottery-item'><div class='img-box'><img src='" + this.model.url + "'></div></div></li>");

	this.active = function() {
		this.el.addClass("cur");
	}

	this.deActive = function() {
		this.el.removeClass("cur");
	}

	this.render = function(c) {
		$(c).append($(this.el));
	}
}

var resource = [{
		src: "./images/lottery/c_1.png",
		flag: "0"
	},
	{
		src: "./images/lottery/c_2.png",
		flag: "1"
	},
	{
		src: "./images/lottery/c_3.png",
		flag: "2"
	},
	{
		src: "./images/lottery/c_4.png",
		flag: "3"
	},
	{
		src: "./images/lottery/c_5.png",
		flag: "4"
	},
	{
		src: "./images/lottery/c_6.png",
		flag: "5"
	},
	{
		src: "./images/lottery/c_7.png",
		flag: "6"
	},
	{
		src: "./images/lottery/c_8.png",
		flag: "7"
	}
];

var pList = [];
for(var i = 0; i < resource.length; i++) {
	pList.push(new Part(resource[i].src, resource[i].flag));
}

var engine = new Engine(pList, $(".lotteryDraw"));
engine.render();

function getGift(codeid, value) {
	$("#alertDiv").hide();
	engine.startFlag = false;
	$.ajax({
		url: ajaxdomain + "/lottery/mobile/jiugongge?ss=" + new Date().getMilliseconds(),
		dataType: "jsonp",
		data: {
			plat: platid,
			codeid: codeid,
			value: value,
		},
		success: function(d) {
			//engine.startFlag = true;
			if(d.rc == 0) {
				engine.start();
				engine.result = d.prize;
				engine.prizeType = d.prizetype;
				engine.prizeTxt = d.msg;
			} else {
				// $(".lottery-dialog-box").show();
				// $(".lottery-dialog-box .dialog-title").text(d.msg);
				alert(d.msg);
				mySlidercaptcha.reset();
				engine.startFlag = true;
			}
		},
		error: function() {
			mySlidercaptcha.reset();
			engine.startFlag = true;
		}
	})
}

mySlidercaptcha = new worker();
mySlidercaptcha.init({
	//debug妯″紡 "success锛氭粦鍔ㄤ竴瀹氶€氳繃锛沞rror锛氭粦鍔ㄤ竴瀹氫笉閫氳繃"锛岀敤浜庢祴璇�
	//debug: 'success',
	//婊戝潡楠岃瘉div涓殑id
	renderTo: '#mycode',
	btnCancel: ".btnCancle",
	width: 379, // width
	height: 40, // height
	successMsg: "楠岃瘉鎴愬姛", // 楠岃瘉鎴愬姛鎻愮ず鏂囧瓧
	//楠岃瘉鎴愬姛鍥炶皟鍑芥暟
	success: function(data) {
		//alert("楠岃瘉鎴愬姛!" + "   codeid:" + data.codeid + "  value:" + data.value);
		getGift(data.codeid, data.value);
	},
	//楠岃瘉澶辫触鍥炶皟鍑芥暟
	error: function(error) {
		alert("楠岃瘉閿欒璇烽噸璇�");
		console.log("respcode:" + error.respcode);
		mySlidercaptcha.reset();
	},
});

function getLotteryHistory() {
	$.ajax({
		url: ajaxdomain + "/lottery/mobile/lotteryhistorys?ss=" + new Date().getMilliseconds(),
		dataType: "jsonp",
		success: function(d) {
			if(d.code == "200") {
				if(d.prizelist.length > 0 || d.bigprizelist.length > 0) {
					var _str = [];
					$.each(d.bigprizelist, function(k, v) {
						_str.push("<li><div class='list-name'>" + v.membername + "</div><div class='list-time'>" + v.time + "</div><div class='list-content'>" + v.prize + "</div></li>");
					});
					$.each(d.prizelist, function(k, v) {
						_str.push("<li><div class='list-name'>" + v.membername + "</div><div class='list-time'>" + v.time + "</div><div class='list-content'>" + v.prize + "</div></li>");
					});
					$("#lottery-histroy").html("<div class='box'><ul class='list'>" + _str.join("") + "</ul></div>");
					$("#lottery-histroy").cxScroll({
						direction: 'bottom',
						speed: 800,
						time: 1500,
						step: 5,
						prevBtn: false,
						nextBtn: false
					});
					setTimeout(function() {
						getLotteryHistory();
					}, 120000);
				} else {
					$("#lottery-histroy").text("鏆傛棤涓绾綍锛�");
				}
			}
		}
	});
}

$(function() {
	getLotteryHistory();
	$(".resultBtn").click(function() {
		$("#result").hide();
		$(".hbj").hide();
		$(".gotoaddrs").hide();
	});
	$("#alertDiv .close").click(function() {
		$("#alertDiv").hide();
		mySlidercaptcha.reset();
	});
	$(".gotoaddrs").click(function() {
		window.location.href = addrsDoman;
	});

	$(".lottery-wrap-close").click(function() {
		$(".lottery_190520").hide();
		$(".lottery_190520_mask").hide();
	});

	$(".luck-content").click(function() {
		if(!passport.isLogin()) {
			passport.show();
		} else {
			$.ajax({
				url: ajaxdomain + "/lottery/mobile/status?ss=" + new Date().getMilliseconds(),
				dataType: "jsonp",
				data: {},
				success: function(d) {
					//engine.startFlag = true;
					if(d.status == 200) {
						if(d.data && d.data.length == 2 && ((d.data[0].success && d.data[0].t) || (d.data[1].success && d.data[1].t > 0))) {
							window.scrollTo(0, 0);
							$(".lottery_190520_mask").show();
							$(".lottery_190520").show();
							engine.startFlag = true;
							mySlidercaptcha.reset();
						} else {
							if(passport && passport.cookie) {
								var loginName = $.trim(passport.cookie.loginName);
								var reg = /^0?1\d{10}$/;
								if(reg.test(loginName)) {
									$('#dialog-input-phone').val(loginName)
								}
							}
							$("#le-dialog-box .dialog-title").text("棰勭害鎶藉锛岃喘鏈哄悗鎶藉厤鍗曪紝璇疯緭鍏ユ墜鏈哄彿锛�");
							$("#le-dialog-box").show();
							$("body").addClass("maskShow");
							engine.startFlag = true;
							mySlidercaptcha.reset();
						}
					} else {
						// $(".lottery-dialog-box").show();
						// $(".lottery-dialog-box .dialog-title").text(d.msg);
						alert(d.msg);
						engine.startFlag = true;
					}
				},
				error: function(e) {
					console.log(e);
					if(passport && passport.cookie) {
						var loginName = $.trim(passport.cookie.loginName);
						var reg = /^0?1\d{10}$/;
						if(reg.test(loginName)) {
							$('#dialog-input-phone').val(loginName)
						}
					}
					$("#le-dialog-box .dialog-title").text("棰勭害鎶藉锛岃喘鏈哄悗鎶藉厤鍗曪紝璇疯緭鍏ユ墜鏈哄彿锛�");
					$("#le-dialog-box").show();
					$("body").addClass("maskShow");
					engine.startFlag = true;
				}
			})

		}
	});

	$(".play-btn").click(function() {
		if(!passport.isLogin()) {
			passport.show();
		} else {
			$.ajax({
				url: ajaxdomain + "/lottery/mobile/status?ss=" + new Date().getMilliseconds(),
				dataType: "jsonp",
				data: {},
				success: function(d) {
					//engine.startFlag = true;
					if(d.status == 200) {
						if(d.data && d.data.length == 2 && ((d.data[0].success && d.data[0].t) || (d.data[1].success && d.data[1].t > 0))) {
							if(engine.startFlag) {
								$("#alertDiv").show();
							}
						} else {
							$(".lottery_190520").hide();
							$(".lottery_190520_mask").hide();
							if(passport && passport.cookie) {
								var loginName = $.trim(passport.cookie.loginName);
								var reg = /^0?1\d{10}$/;
								if(reg.test(loginName)) {
									$('#dialog-input-phone').val(loginName)
								}
							}
							$("#le-dialog-box .dialog-title").text("棰勭害鎶藉锛岃喘鏈哄悗鎶藉厤鍗曪紝璇疯緭鍏ユ墜鏈哄彿锛�");
							$("#le-dialog-box").show();
							$("body").addClass("maskShow");
							engine.startFlag = true;
							mySlidercaptcha.reset();
						}
					} else {
						// $(".lottery-dialog-box").show();
						// $(".lottery-dialog-box .dialog-title").text(d.msg);
						alert(d.msg);
						engine.startFlag = true;
						mySlidercaptcha.reset();
					}
				},
				error: function(e) {
					console.log(e);
					if(passport && passport.cookie) {
						var loginName = $.trim(passport.cookie.loginName);
						var reg = /^0?1\d{10}$/;
						if(reg.test(loginName)) {
							$('#dialog-input-phone').val(loginName)
						}
					}
					$("#le-dialog-box .dialog-title").text("棰勭害鎶藉锛岃喘鏈哄悗鎶藉厤鍗曪紝璇疯緭鍏ユ墜鏈哄彿锛�");
					$("#le-dialog-box").show();
					$("body").addClass("maskShow");
					engine.startFlag = true;
					mySlidercaptcha.reset();
				}
			})

		}
	})

	//鍏抽棴
	$(".close-pop, .result-btn").click(function() {
		$(".lottery-pop").hide();
	});
});

/* 
       =========================================  liulb7 end  ===========================================
   */
$(function() {
	var $sideBar = $('.sideBar');
	var allItem = $sideBar.find('[light]');

	var allSideBarA = $sideBar.children('a')
	var allFloor = $('.category-item');
	var arrFloor = [];
	var ref = {}
	allFloor.each(function() {
		var curTop = $(this).offset().top;
		arrFloor.push(curTop);
		ref[curTop] = $(this).attr('id');
	})

	// allItem.each(function () {
	//     allItem[$(this).attr('href')] = $()
	// })

	$(window).scroll(function() {
		var sTop = $(window).scrollTop();
		// console.log(stop);
		if(sTop >= 625) {
			$sideBar.fadeIn();
		}
		if(sTop < 625) {
			$sideBar.fadeOut();
		}

		allSideBarA.removeClass('active');
		for(var i = arrFloor.length; i > 0; i--) {
			if(sTop > arrFloor[i] - 50) {
				$('a[href="#' + ref[arrFloor[i]] + '"]').addClass('active');
				break;
			}
		}
	});
});

(function() {
	$.ajax({
		url: 'https://promotion.lenovo.com.cn/api/activity/getReservNumByCodes.jhtm?terminal=2&shopId=1&gcode=1004633',
		type: 'get',
		success: function(data) {
			$('.appointment span').text(data.t[0].num);
		},
		error: function(XMLHttpRequest, textStatus, errorThrown) {
			console.log(textStatus);
			$('.appointment').hide();
		}
	});
})()